package com.xxh.springclouddemo.nacos.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author xxh
 * @Date 2024/4/3 21:36
 */
@RestController
@RefreshScope   //修改配置文件后则重新生成bean
public class ConfigController {

    @Value("${student.name}")
    private String name;

    @GetMapping("/config/info")
    public String getConfigInfo(){
        System.out.println(this);
        String configInfo=name;
        return configInfo;
    }

}

